<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Welcome Page with Stars Animation</title>
<style>
    body {
        margin: 0;
        padding: 0;
        height: 100vh;
        display: flex;
        justify-content: center;
        align-items: center;
        overflow: hidden;
        perspective: 1000px;
        background: linear-gradient(45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
        background-size: 400% 400%;
        animation: gradient 15s ease infinite;
    }

    @keyframes gradient {
        0% {
            background-position: 0% 50%;
        }
        50% {
            background-position: 100% 50%;
        }
        100% {
            background-position: 0% 50%;
        }
    }

    .star {
        position: absolute;
        width: 2px;
        height: 2px;
        background-color: #fff;
        border-radius: 50%;
    }

    .welcome {
        text-align: center;
        color: #fff;
        position: relative;
        z-index: 1;
    }

    button {
        padding: 10px 20px;
        background-color: #4CAF50;
        color: white;
        border: none;
        border-radius: 5px;
        cursor: pointer;
    }
</style>
</head>
<body>
<div class="background"></div>
<div class="welcome">
    <h1>Welcome to My Website!</h1>

    <button onclick="location.href='{% url 'login' %}'">Go to Login</button>
</div>

<script>
    document.addEventListener('DOMContentLoaded', function() {
        const numStars = 50; // 星星数量
        const stars = [];

        // 创建星星
        for (let i = 0; i < numStars; i++) {
            const star = document.createElement('div');
            star.classList.add('star');
            star.style.top = Math.random() * 100 + 'vh';
            star.style.left = Math.random() * 100 + 'vw';
            stars.push(star);
            document.body.appendChild(star);
        }

        // 鼠标移动事件
        document.addEventListener('mousemove', function(event) {
            stars.forEach(function(star) {
                const speed = 0.1;
                const deltaX = (event.clientX - star.getBoundingClientRect().left - star.clientWidth / 2) * speed;
                const deltaY = (event.clientY - star.getBoundingClientRect().top - star.clientHeight / 2) * speed;

                star.style.transform = 'translate(' + deltaX + 'px, ' + deltaY + 'px)';
            });
        });
    });
</script>
</body>
</html>
